﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

using UnityEngine.Rendering.PostProcessing;

using YYPostProcessing;

public class GUIControl : MonoBehaviour {

    private PostProcessLayer PostProcessLayer;
    private MobilePostProcessing MobilePostProcessing;
    private MobileUnityPostProcessing MobileUnityPostProcessing;

    private YYPostProcessLayer YYPostProcessLayer;
    
    private void Awake()
    {
        PostProcessLayer = GetComponent<PostProcessLayer>();
        MobilePostProcessing = GetComponent<MobilePostProcessing>();
        MobileUnityPostProcessing = GetComponent<MobileUnityPostProcessing>();

        YYPostProcessLayer = GetComponent<YYPostProcessLayer>();
    }

    private int interval = 110;


    private void OnGUI()
    {
        int i = 0;
        if (GUI.Button(new Rect(0, 0, 100, 100), new GUIContent("no_bloom")))
        {
            PostProcessLayer.enabled = false;
            MobilePostProcessing.enabled = false;
            MobileUnityPostProcessing.enabled = false;
            YYPostProcessLayer.enabled = false;
        }

        i++;
        if (GUI.Button(new Rect(0+ i* interval, 0, 100, 100), new GUIContent("bloom")))
        {
            PostProcessLayer.enabled = true;
            MobilePostProcessing.enabled = false;
            MobileUnityPostProcessing.enabled = false;
            YYPostProcessLayer.enabled = false;
        }

        i++;
        if (GUI.Button(new Rect(0 + i * interval, 0, 100, 100), new GUIContent("mobile_bloom")))
        {
            PostProcessLayer.enabled = false;
            MobilePostProcessing.enabled = true;
            MobileUnityPostProcessing.enabled = false;
            YYPostProcessLayer.enabled = false;
        }

        //i++;
        //if (GUI.Button(new Rect(0 + i * interval, 0, 100, 100), new GUIContent("mobile_unity_bloom")))
        //{
        //    PostProcessLayer.enabled = false;
        //    MobilePostProcessing.enabled = false;
        //    MobileUnityPostProcessing.enabled = true;
        //    YYPostProcessLayer.enabled = false;
        //}

        i++;
        if (GUI.Button(new Rect(0 + i * interval, 0, 100, 100), new GUIContent("yy_bloom")))
        {
            PostProcessLayer.enabled = false;
            MobilePostProcessing.enabled = false;
            MobileUnityPostProcessing.enabled = false;
            YYPostProcessLayer.enabled = true;
        }

        i++;
        if (GUI.Button(new Rect(0 + i * interval, 0, 100, 100), new GUIContent("all")))
        {
            PostProcessLayer.enabled = true;
            //MobilePostProcessing.enabled = true;
            //MobileUnityPostProcessing.enabled = true;
            YYPostProcessLayer.enabled = true;
        }
    }
}
